package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author__lzl
 * @version__1.0
 */
@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id查询套餐id
     * @param dishIds
     * @return
     */

   List<Long> getSetMealIdsByDishIds(List<Long> dishIds);

    /**
     * 将菜品和套餐的关联 存储
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 将菜品和套餐的关联 删除
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);
    /**
     * 查询菜品和套餐的关联
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);

 /**
  *
  * @param dishIds
  * @return
  */
  @Select("select setmeal_id from setmeal_dish where dish_id in #{dishIds}")
 List<Long> getSetmealIdsByDishIds(List<Long> dishIds);
}
